package com.dgut.leave.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.dgut.leave.entity.Leave;

@Repository
public interface LeaveRepository extends PagingAndSortingRepository<Leave, Long>, JpaSpecificationExecutor<Leave> {
	// 根据用户登录的userId查出请假单
	@Query("from Leave leave where leave.userId = ?1")
	public Page<Leave> findLeave(String userId, Pageable pageable);
}
